<?php

namespace App\Models;

use DateTimeInterface;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

/**
 * Class MeetHour
 * *
 * @property $meet_hour_id  唯一ID
 * @property $venue_id  场馆id
 * @property $meet_day_id  日期id
 * @property $start  开始时间点hh:mm ～
 * @property $end  结束时间点hh:mm
 * @property $is_limit  是否人数限制
 * @property $limit  报名上限
 * @property $status  状态
 * @property $publisher_uid  发布者uid
 * @property $created_at  
 * @property $updated_at  
 * @property $deleted_at  
 *
 * @package  App\Models
 * @mixin \Illuminate\Database\Eloquent\Builder
 */
class MeetHour extends Model 
{
    use SoftDeletes;

    protected $table = 'meet_hours';

    protected $fillable = ['meet_hour_id', 'venue_id', 'meet_day_id', 'start', 'end', 'is_limit', 'limit', 'status', 'publisher_uid'];
    
    protected function serializeDate(DateTimeInterface $date)
    {
        return $date->format($this->dateFormat ?: 'Y-m-d H:i:s');
    }

    public function venue(){
        return $this->belongsTo(Venue::class, 'venue_id');
    }
    public function day(){
        return $this->belongsTo(MeetDay::class, 'meet_day_id');
    }
}